Skip to content

fix(xcode_build): prevent configuration from overriding scheme defaults#21

Open
Ghun2 wants to merge 1 commit intoconorluddy:mainfrom
Ghun2:fix/scheme-configuration-override
Open

fix(xcode_build): prevent configuration from overriding scheme defaults#21
Ghun2 wants to merge 1 commit intoconorluddy:mainfrom
Ghun2:fix/scheme-configuration-override

Conversation

@Ghun2
Copy link
Copy Markdown

@Ghun2 Ghun2 commented Jan 16, 2026

Problem

When using xcode_build with a custom scheme (e.g., Debug-Dev), the tool always passes -configuration Debug to xcodebuild, overriding the scheme's default configuration.

Example

# User calls:
xcode_build(scheme: "Debug-Dev")

# Expected xcodebuild command:
xcodebuild -workspace project.xcworkspace -scheme Debug-Dev build

# Actual command (bug):
xcodebuild -workspace project.xcworkspace -scheme Debug-Dev -configuration Debug build

This causes the scheme's build settings to be ignored, as the explicit -configuration Debug takes precedence.

Solution

  1. Remove enum restriction: Allow custom configurations like Debug-Dev, Release-Prod
  2. Make configuration optional: Only add -configuration flag when explicitly provided
  3. Use scheme defaults: When configuration is omitted, let xcodebuild use the scheme's default

Before

configuration: {
  type: "string",
  enum: ["Debug", "Release"],
  description: "Build configuration (default: Debug)",
},
// ...
const args = [
  "-scheme", params.scheme,
  "-configuration", params.configuration || "Debug",
];

After

configuration: {
  type: "string",
  description: "Build configuration (e.g., Debug, Release, Debug-Dev, Release-Prod). If omitted, uses scheme default.",
},
// ...
const args = ["-scheme", params.scheme];
// Only add configuration if explicitly provided (let xcodebuild use scheme default otherwise)
if (params.configuration) {
  args.push("-configuration", params.configuration);
}

Testing

Tested with Xcode project using custom schemes:

  • Debug-Dev scheme now correctly uses its associated build configuration
  • Release-Prod scheme works as expected
  • Explicit configuration parameter still works when provided

Checklist

  • Code follows project style guidelines
  • No breaking changes for existing users
  • Backward compatible (explicit configuration still works)

🤖 Generated with Claude Code

Problem:
- xcode_build always passed `-configuration Debug` even when using
  custom schemes like Debug-Dev or Release-Prod
- This overrode the scheme's default build configuration

Solution:
- Remove enum restriction ["Debug", "Release"] to allow custom configs
- Only add -configuration flag when explicitly provided
- Let xcodebuild use scheme's default configuration when omitted

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant